﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BEGDC.CC.Web.UserControls;
using BEGDC.CC.BL.CCFlow.CR;
using BEGDC.CC.Entity;
using BEGDC.CC.BL.Workflow;
using BEGDC.CC.BL.Common;
using BEGDC.Utility.Castle;
using BEGDC.CC.BL.UserManagement;
using BEGDC.CC.BL.Common.Query;

namespace BEGDC.CC.Web.SystemManagement
{
	/// <summary>
	/// Summary description for CISApplicationQuery.
	/// </summary>
	public class CISApplicationQuery : System.Web.UI.Page
	{
		#region VARIABLES
		protected System.Web.UI.WebControls.DataGrid DG_CustomerList;
		protected System.Web.UI.WebControls.ImageButton Btn_Save;
		protected System.Web.UI.WebControls.DropDownList Dp_AppType;
		protected System.Web.UI.WebControls.Label lblDescription;
		protected System.Web.UI.WebControls.ImageButton btnExport;
		protected System.Web.UI.WebControls.ImageButton Btn_Close;
		#endregion
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				InitForm();
			}
		}

		#region InitForm
		private void InitForm()
		{
			if(this.Dp_AppType.SelectedItem!=null)
			{
				IQuery QueryService = AppContainer.Instance[ServiceConst.QueryService] as IQuery;
				DataTable dataTable = QueryService.GetApplicationNotInCIS(this.Dp_AppType.SelectedValue);
				this.DG_CustomerList.DataSource = dataTable;
				this.DG_CustomerList.DataBind();
			}
		}
		#endregion

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Dp_AppType.SelectedIndexChanged += new System.EventHandler(this.Dp_AppType_SelectedIndexChanged);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		#region Select Index Change
		private void Dp_AppType_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(this.Dp_AppType.SelectedItem!=null)
			{
				IQuery QueryService = AppContainer.Instance[ServiceConst.QueryService] as IQuery;
				DataTable dataTable = QueryService.GetApplicationNotInCIS(this.Dp_AppType.SelectedValue);
				this.DG_CustomerList.DataSource = dataTable;
				this.DG_CustomerList.DataBind();
			}
		}
		#endregion
	}
}
